<?php
namespace app\before\validate;

use think\Validate;

class Coupon extends Validate
{
    protected $rule = [
        'z_num' => 'require|number',
        'i_num' => 'require|number',
        'get_num' => 'require|number',
        'use_validate' => 'require|number',
        'issue_time' => 'require|number',
        'validate_time' => 'require|number',
        'start_use' => 'require|number',
        'end_use' => 'require|number',
        'user_id' => 'require|number',
        'jump' => 'require',
        'foreign_key' => 'require|number',
        'min_age' => 'require|number',
        'max_age' => 'require|number',
        'sex' => 'require',
        'zhiye' => 'require|number',
        'type' => 'require',
        'add_time' => 'require|number',
    ];
    protected $message = [
        'z_num.require' => '折扣数值为必填项',
        'z_num.number' => '折扣数值需为数字',
        'i_num.require' => '折扣券数量为必填项',
        'i_num.number' => '折扣券数量需为数字',
        'get_num.require' => '剩余数量为必填项',
        'get_num.number' => '剩余数量需为数字',
        'use_validate.require' => '使用条件为必填项',
        'use_validate.number' => '使用条件需为数字',
        'issue_time.require' => '定时发布时间为必填项',
        'issue_time.number' => '定时发布时间需为数字',
        'validate_time.require' => '有效期为必填项',
        'validate_time.number' => '有效期需为数字',
        'start_use.require' => '开始日期为必填项',
        'start_use.number' => '开始日期需为数字',
        'end_use.require' => '截止日期为必填项',
        'end_use.number' => '截止日期需为数字',
        'user_id.require' => '发布人ID为必填项',
        'user_id.number' => '发布人ID需为数字',
        'jump.require' => '跳转类型  1：服务  2：需求 3：个人主页为必填项',
        'foreign_key.require' => '跳转项ID为必填项',
        'foreign_key.number' => '跳转项ID需为数字',
        'min_age.require' => '要求-最小年龄为必填项',
        'min_age.number' => '要求-最小年龄需为数字',
        'max_age.require' => '要求-最大年龄为必填项',
        'max_age.number' => '要求-最大年龄需为数字',
        'sex.require' => '要求-性别 0：不要求  1：男  2：女为必填项',
        'zhiye.require' => '职业id为必填项',
        'zhiye.number' => '职业id需为数字',
        'type.require' => '类型 1：优惠券  2：折扣券 3：代金券为必填项',
        'add_time.require' => '添加时间为必填项',
        'add_time.number' => '添加时间需为数字',
    ];
    protected $scene = [
        'edit' => [
            'z_num',
            'i_num',
            'get_num',
            'use_validate',
            'issue_time',
            'validate_time',
            'start_use',
            'end_use',
            'user_id',
            'jump',
            'foreign_key',
            'min_age',
            'max_age',
            'sex',
            'zhiye',
            'type',
            'add_time',
        ],
    ];
}
